<?php

namespace App\Http\Controllers\Internal\Company;

use App\Http\Controllers\BaseController;
use App\Models\Common\FsCompanyModel;
use Illuminate\Http\Request;

class FsCompanyController extends BaseController
{
    public function addFsCompany(Request $request)
    {
        $this->validate($request, [
            'name'         => 'required|string',
            'departmentId' => 'required|string',
            'status'       => 'required|integer|in:0,1',
        ]);

        $name         = $request->get('name');
        $departmentId = $request->get('departmentId');
        $status       = (int)$request->get('status');

        $fsCompany = FsCompanyModel::addV2($name, $departmentId, $status);

        return $this->success($fsCompany->toArray());
    }
}
